Marvel and Fox made a secret trade for characters in “Guardians of the Galaxy 2” and “Deadpool.” 20th Century Fox

If you’re a fan of Marvel movies, you’re aware that Marvel Studios has the rights to certain characters such as Captain America, Iron Man and Thor, while Fox has the rights to the X-Men, Fantastic Four and Deadpool.

But while many fans are aware of which popular characters can and can’t be used by the studios, there are some lesser known characters that fans are unaware of. In Fox’s “Deadpool,” the titular character teams up with Colossus and Negasonic Teenage Warhead. It was easy for Fox to use Colossus since he is an X-Men character, but Teenage Warhead proved to be a tricky.

During a Q&A screening at Fox Studios in Los Angeles this past weekend, “Deadpool” co-screenwriter Paul Wernick explained a deal Fox had to make with Marvel to use Negasonic Teenage Warhead. In the comics, the character is a psychic, but the “Deadpool” team wanted her to create explosions.

According to Wernick, this meant Fox had to ask Marvel for permission to change the character. Marvel agreed, but on one condition: it wanted the character Ego the Living Planet for the upcoming “Guardians of the Galaxy 2.”

Ego, a sentient planet, will be played by Kurt Russell in the upcoming film and will be Peter Quill’s (Chris Pratt) father. “Guardians of the Galaxy 2” director James Gunn took to his Facebook page to confirm the trade Marvel made.

“Yes, this is true!” Gunn wrote on Facebook. “When I first pitched Ego as Quill’s father, I THOUGHT we owned the character. After I had worked out a very elaborate story with Ego the Living Planet as a very important part of the Marvel cosmic universe, I learned that we actually didn’t own the character. I had no backup plan, and it would be nearly impossible to just drop another character in. Thank God Fox came to us and wanted to make a trade.”

It’s not the first time Marvel Studios has used a character that didn’t belong to its roster. For “Captain America: Civil War,” Marvel had to strike a deal with Sony Pictures to include Spider-Man in the film.

Marvel’s “Guardians of the Galaxy 2” releases on May 5, 2017.