Given two unitaries such that $U_1|0\rangle = |\psi(x)\rangle$ and $U_2|0\rangle = |\phi(y)\rangle$, do the unitary $U_t = U_2 U_1^{\dagger}$ on $|\phi(y)\rangle$ controlled by a Hadamard transformed control qubit, perform an extra Hadamard on the control qubit, and then measure the control qubit. After performing this measurement multiple times, if a $|0\rangle$ result is treated as a 1 and a $|1\rangle$ as -1, the expected value will be the real part of the inner product. Change the circuit to perform a $S^{-1}$ on the controlled qubit just before the controlled unitary (so the state of the control qubit is $|0\rangle - i|1\rangle$ prior to entanglement) and the measurement's expected value will be the imaginary part of the inner product. Doing both measurements enough times to estimate the expected values will provide the complete inner product.
This works because $\langle \phi(y) |U_t|\phi(y)\rangle = \langle\psi(x)|\phi(y)\rangle$ and these real and imaginary circuits will respectively leave the system in the state $\frac{1}{2}(|0\rangle \otimes(I + U_t)|\phi(y)\rangle + |1\rangle\otimes(I - U_t)|\phi(y)\rangle)$ and $\frac{1}{2}(|0\rangle\otimes(I - i U_t)|\phi(y)\rangle + |1\rangle\otimes(I + i U_t)|\phi(y)\rangle)$. The probably of measuring $|0\rangle$ and $|1\rangle$ in each respective case are $\frac{1}{4}(2 + \langle\psi(x)|\phi(y)\rangle + \langle\phi(y)|\psi(x)\rangle)$ and $\frac{1}{4}(2 - \langle\psi(x)|\phi(y)\rangle - \langle\phi(y)|\psi(x)\rangle)$ for real case and $\frac{1}{4}(2 - i\langle\psi(x)|\phi(y)\rangle + i\langle\phi(y)|\psi(x)\rangle)$ and $\frac{1}{4}(2 + i\langle\psi(x)|\phi(y)\rangle - i\langle\phi(y)|\psi(x)\rangle)$ for imaginary. Subtracting the second from the first in each case, the results are $\textit{Re}(\langle\psi(x)|\phi(y)\rangle)$ and $\textit{Im}(\langle\psi(x)|\phi(y)\rangle)$, and the expected value if converted to -1 and 1 is equivalent to this probability subtraction.
This technique is called the Hadamard test.