  The Birch and Swinnerton--Dyer conjecture famously predicts that the rank of
an elliptic curve can be computed from its $L$-function. In this article we
consider a weaker version of this conjecture called the parity conjecture and
prove the following. Let $E_1$ and $E_2$ be two elliptic curves defined over a
number field $K$ whose 2-torsion groups are isomorphic as Galois modules.
  Assuming finiteness of the Shafarevich-Tate groups of $E_1$ and $E_2$, we
show that the Birch and Swinnerton-Dyer conjecture correctly predicts the
parity of the rank of $E_1\times E_2$. Using this result, we complete the proof
of the $p$-parity conjecture for elliptic curves over totally real fields.
