Find the word definition

Wiktionary
the enemy of my enemy is my friend

alt. It is sometimes necessary to cooperate with a person one does not like or agree with, in order to combat a common threat. prov. It is sometimes necessary to cooperate with a person one does not like or agree with, in order to combat a common threat.

Wikipedia
The enemy of my enemy is my friend

The enemy of my enemy is my friend is an ancient proverb which suggests that two opposing parties can or should work together against a common enemy. The earliest known expression of this concept is found in a Sanskrit treatise on statecraft dating to around the 4th century BC, while the first recorded use of the current English version came in 1884.

The proverb is sometimes phrased as "the enemy of mine enemy is my friend" or "my enemy's enemy is my friend."