  We show that the Hong-Ou-Mandel effect from quantum optics is equivalent to
the SWAP test, a quantum information primitive which compares two arbitrary
states. We first derive a destructive SWAP test that doesn't need the ancillary
qubit that appears in the usual quantum circuit. Then, we study the
Hong-Ou-Mandel effect for two photons meeting at a beam splitter and prove it
is, in fact, an optical implementation of the destructive SWAP test. This
result offers both an interesting simple realization of a powerful quantum
information primitive and an alternative way to understand and analyse the
Hong-Ou-Mandel effect.
