I'm pretty sure there's a saying for "people who are in a similar situation and understand each other". Unfortunately, I can't even come up with it in my native language (Spanish).
A: You broke up with your boyfriend.
B: What? How do you know?
A: Because I broke up with my partner too. [The saying goes here].