I would like to know the following "local-global" principle holds (all the tensors are taken over $\Bbb Z$):
Let $A,B$ be two abelian groups. Assume that $f \otimes \text{id}_{\Bbb Q}$ and $f \otimes \text{id}_{\Bbb{F}_p}$ are isomorphisms (for all primes $p$). Is it true that $f:A\to B$ is a group isomorphism? Does it become true if we assume that $A$ and $B$ are finitely generated?
The converse is trivial, since $- \otimes M$ is a functor for every abelian group $M$. My question is somehow related to the notion of conservative functor or functors reflecting isomorphisms.
(Notice that in a general situation, if $f \otimes \text{id}_M : A \otimes_R M \to B \otimes_R M$ is an isomorphism for all $R$-modules $M$, then it follows that $f$ is an isomorphism because we just have to take $M=R$).
— I will assume here that $A,B$ are finitely generated. Then we can write $$A=\mathbb{Z}^{r} \oplus \bigoplus_{i=1}^{N} \mathbb{Z}/p_{i}^{a_{i}}\mathbb{Z}, \quad p_{i} \text{ prime numbers, } a_{i}, r \geq 0$$ $$B=\mathbb{Z}^{s} \oplus \bigoplus_{i=1}^{K} \mathbb{Z}/q_{i}^{b_{i}}\mathbb{Z}, \quad q_{i} \text{ prime numbers, } b_{i}, s \geq 0$$
Since $A \otimes \Bbb Q \cong B \otimes \Bbb Q$ and $A \otimes \Bbb F_p \cong B \otimes \Bbb F_p$ for all primes $p$, it follows that $A \cong B$ (because $r=s,K=N,p_i=q_i,a_i=b_i$). We know that there exists an isomorphism from $A$ to $B$, but I don't see why $f$ should be an iso.
— I believe that for the non-finitely generated case we could find sufficiently big abelian groups to make my statement wrong. A good way to start would be to find non isomorphic abelian groups $A,B$ such that $$A \otimes \Bbb Q \cong B \otimes \Bbb Q \text{ and }A \otimes \Bbb F_p \cong B \otimes \Bbb F_p \text{ for all primes } p.$$
— Here are some possibly related questions: Is the image of a tensor product equal to the tensor product of the images?, Tensor product and injective maps, What is the kernel of the tensor product of two maps?, Relation between $\operatorname{Coker}(f)$ and $\operatorname{Coker}(f \otimes 1_P)$.
Any suggestion will be appreciated!