How to solve $A^{\frac 12} B A^{\frac 12} = C$ for $A$?

The problem is: find the solutions of the equation

(*) $XBX=C$ where the unknown $X$ and the given matrices $B,C$ are $n\times n$ symmetric $>0$.

$\textbf{Proposition.}$ (*) has the unique solution

$X=B^{-1/2}S^{1/2}B^{-1/2}$, where $S=B^{1/2}CB^{1/2}$.

$\textbf{Proof}.$ (*) is equivalent to $(XB)^2=CB$, that is,

$(XB)^2=B^{-1/2}SB^{1/2}$, where $S$ is symmetric $>0$.

We put $XB=B^{-1/2}ZB^{1/2}$ where $Z^2=S$.

Then $Z=B^{1/2}XB^{1/2}$ is symmetric $>0$ and $Z=S^{1/2}$.

Finally $X=B^{-1/2}S^{1/2}B^{-1/2}$ as required. $\square$