Even for celeb couples, there’s no way around it — going through a breakup sucks. What sucks even worse is going through a breakup when you work with your ex. When a “regular couple” who works together splits, it’s reasonable to assume they can sidestep each other. You can awkwardly duck into your cubicle anytime your former flame walks by. You can carefully orchestrate the times you arrive and leave each day so as not to suffer through the deafening silence of a shared elevator. You can avoid the break room like a plague.

For celebrities, this proves particularly tricky. Can you imagine having to show up to work every day and make out with your ex, or pretend like you’re together and happy? Even worse, what if you called off your engagement in real life but had to marry your former betrothed onscreen?

That’s precisely the sort of emotional torture the following celebrities endured when they broke up but still collaborated creatively. And, impressively, many even managed to remain friends after the fact.

Jennifer Carpenter and Michael C. Hall

Jennifer Carpenter Michael C. Hall

On the grisly Showtime series Dexter, Jennifer Carpenter played Deb — the adopted sister of Michael C. Hall’s eponymous serial killer. Despite the fact that there wasn’t any intimacy between the two on set (aside from in Deb’s dreams after falling “in love” with Dex), they worked about as closely as you can for the duration of the series. You can see how that might have been tense at times, given they were married and divorced within Dexter’s span. The show aired from 2006 to 2013; Carpenter and Hall married in 2008 and divorced in 2011.

However, the couple insists that they kept their relationship professional on set and amicable off. During a PaleyFest panel, Hall called it “gratifying” that he and Carpenter could remain true to the show and finish it out together.

Visibly emotional, Carpenter added, “Like, our marriage didn’t look like anyone else’s, and our divorce didn’t either… I’ve said it before, and we’ve said it before, that, like, just because the marriage ended doesn’t mean the love did.”

Ian Somerhalder and Nina Dobrev

Ian Somerhalder Nina Dobrev

When Nina Dobrev announced in 2015 that she was leaving The Vampire Diaries after six seasons, fans threw a veritable fit. The prevailing speculation? That the actress must be leaving due to her 2013 breakup with costar Ian Somerhalder, whom she met on set and dated for three years. But Dobrev quickly nipped any rumors about drama in the bud, telling E! News, “I’ve said this before, that we didn’t break up because anything bad happened or because there wasn’t love or friendship.”

The actress — who played Elena, the love interest of Somerhalder’s character, Damon — also pointed out that their relationship didn’t exist solely in the vacuum of the show, saying, “We were friends long before we dated and we still are now.”

While Dobrev did ultimately decide to leave the show prior to its end, she returned for the series finale to give fans closure. And that closure looked like Elena and Damon living happily ever after, even if the actors portraying them had moved on IRL.

Chad Michael Murray and Sophia Bush

Chad Michael Murray Sophia Bush

Gird yourselves, because this is one celebrity-costar-breakup story that doesn’t end with a warm and fuzzy friendship. One Tree Hill hit TV screens in 2003. By 2005, costars Sophia Bush and Chad Michael Murray were married. However, the couple split up five months into the ill-fated union, with the rumor mill reporting Murray strayed with his House of Wax co-star, Paris Hilton.

Since OTH continued and Murray didn’t leave until 2009, the ex-couple had to play nice for four more years. And judging by Bush’s 2014 appearance on Bravo’s Watch What Happens Live, it wasn’t exactly smooth sailing. When a caller asked if the exes stayed in touch, Bush diplomatically explained that her mother told her “not to say anything at all” if you had nothing nice to say.

She did clarify, though, saying, “We were two stupid kids who had no business being in a relationship in the first place” and that working together forced them to “deal with it.”

Johnny Galecki and Kaley Cuoco

Johnny Galecki Kaley Cuoco

It’s said that opposites attract, and that’s certainly true of Kaley Cuoco’s and Johnny Galecki’s characters on The Big Bang Theory. Penny and Leonard are about as different as they come, and yet the quirky onscreen couple fell in love. Off-screen, life imitated art for the eclectic pairing.

“We dated for almost two years,” Cuoco told CBS Watch Magazine (via Us Weekly). “It was such a huge part of my life and no one knew about it.” The actress called her time with Galecki wonderful but admitted they both realized they weren’t meant to be. “We accepted it and said, ‘Look, if we ever break up, we will be professional,'” Cuoco said. “I’m so lucky it was a mutual ending and that we don’t hate each other. We’ve seen that happen on other shows.”

True to their word, Cuoco and Galecki have remained friends in real life — and their characters even went on to get married (twice, no less).

Read More: