Question. Let $f : A \to B$ be a morphism between two abelians groups. Suppose that the induced morphism $\bar{f} : A \otimes_{\mathbb{Z}} \mathbb{R} \to B \otimes_{\mathbb{Z}} \mathbb{R}$ defined by $\bar{f}(a \otimes x) = f(a) \otimes x$ is an isomorphism. Is it necessarily the case that the induced morphism $A \otimes_{\mathbb{Z}} \mathbb{Q} \to B \otimes_{\mathbb{Z}} \mathbb{Q}$ is an isomorphism?
Motivation. In homotopy theory, a continuous map between based spaces $f : X \to Y$ is called a rational homotopy equivalence if $\pi_n(f) \otimes \mathbb{Q} : \pi_n(X) \otimes \mathbb{Q} \to \pi_n(Y) \otimes \mathbb{Q}$ is an isomorphism for each $n$. Similarly, it's called a real homotopy equivalence if $\pi_*(f) \otimes \mathbb{R}$ is an isomorphism. It's clear that a rational homotopy equivalence is a real homotopy equivalence: $(- \otimes_{\mathbb{Z}} \mathbb{Q}) \otimes_{\mathbb{Q}} \mathbb{R} \cong - \otimes_{\mathbb{Z}} \mathbb{R}$. Is the converse true?
Progress. When $A$ and $B$ are finitely generated abelian groups, the statement is true. Use the decomposition as a direct sum of a torsion group and a free abelian group, so that $A \otimes \mathbb{R} \cong \mathbb{R}^r$ and $B \otimes \mathbb{R} \cong \mathbb{R}^s$. Since there's an isomorphism, $r=s$, and the determinant $\det(f \otimes \mathbb{R})$ is nonzero; but this determinant is equal to $\det(f \otimes \mathbb{Q})$ (in fact it's an integer, equal to $\det(f)$), so $f \otimes \mathbb{Q}$ is also invertible.
I haven't been able to generalize that to abelian groups that are not finitely generated. I suspect the answer is that it's false, but I couldn't come up with a counterexample (surjectivity seems to be the main problem).