Let $\mathcal{H}$ be a complex vector space. By using the notation $\langle . \lvert . \rangle$, you are referring to ana complex inner product $\langle . \lvert . \rangle: \mathcal{H}\times \mathcal{H} \rightarrow \mathbb{C}.$ (i.e.
Let $\mathcal{H}$ be a map that takes two vectors from your complex vector space and sends them to a complex number). This is known as aA complex inner product. By definition is a map $\langle . \lvert . \rangle: \mathcal{H}\times \mathcal{H} \rightarrow \mathbb{C}$ such that $\langle . \lvert . \rangle$ is bilinear (or just linear in one of the arguments), complex inner products arepositive-definite, and conjugate symmetric. Conjugate symmetry gives us for any (among other things)$a,b \in \mathcal{H}$: $$ \langle a \lvert b \rangle = \langle b \lvert a \rangle^*.$$ Hence the necessary condition is that $\langle a \lvert b \rangle \in \mathbb{R} \iff \langle b \lvert a \rangle \in \mathbb{R}$.