In fact, a friendship could be based on little more than a shared hatred of the same enemies. We see this in Sophocles' Philoctetes 389-390 (tr. Hugh Lloyd-Jones):
That is all I have to say; and may he who loathes the sons of Atreus be dear alike to me and to the gods!Lloyd-Jones translates φίλος (philos) as "dear," but it could also be translated "friend" here. Cf. Thomas Francklin's translation:
λόγος λέλεκται πᾶς· ὁ δ᾽ Ἀτρείδας στυγῶν
ἐμοί θ᾽ ὁμοίως καὶ θεοῖς εἴη φίλος.
I've told thee all, and him who hates the AtreidaePhiloctetes utters a similar sentiment at 585-586 (tr. Hugh Lloyd-Jones):
I hold a friend to me and to the gods.
I am their enemy; and this man is my great friend, because he hates the sons of Atreus.
ἐγώ εἰμ᾽ Ἀτρείδαις δυσμενής· οὗτος δέ μοι
φίλος μέγιστος, οὕνεκ᾽ Ἀτρείδας στυγεῖ.