What is the meaning of [The enemy of my enemy is my friend]

MEANING If someone whom I don’t like doesn’t like someone else whom I don’t like, we can act like friends and unite against the other person (common in war)
EXAMPLE “I don’t like you, you don’t like me. But I think we can agree that we both HATE Daniel. Let’s work together and get him fired! The enemy of my enemy is my friend, right?”