The enemy of my enemy is not necessarily my friend.
You don't have to be friends to be allies. During WWII, we were allied with the Soviets, who were obviously our enemy from the day the Bolsheviks took power. We allied with the Khmer Rouge, another enemy, to get Vietnam to leave Cambodia. We allied with China, yet another enemy, to help supply the Afghan resistance during the Afghan-Soviet War. Foreign policy is no different from the life of any small business owner. There are multiple adversaries popping up all the time, and there is no end to them.