It's often been historically the case that groups of disparate ideology and objectives join under one banner to fight a common enemy, and, once (and if) said enemy is defeated, all bets are off in the aftermath. The WW2 Soviet-Western Alliance is a textbook example, but there's multitudes of others.