How does this keep happening?

I have a crush on two people. Normally it wouldn’t be a problem and I’d just try to decide who I liked more but I like them both a lot. They’re both my best friends and I don’t know who I like better because they’re both unavailable. I’m friends with both of their significant others. I know that they are committed but they’re both unhappy(both so’s are kinda neglectful). On top everything they both slightly flirt with me which causes mixed emotions in me. I don’t what to do but the same thing happened(not really but similar). How does it keep happening?