TITLE: Is there a non-trivial group $C$ such that $A*C \cong B*C$ implies $A \cong B$?
QUESTION [38 upvotes]: This is a crosspost from this MSE question from a year ago.

Finite groups are cancellable from direct products, i.e. if $F$ is a finite group and $A\times F \cong B\times F$, then $A \cong B$. A proof can be found in this note by Hirshon. In the same note, it is shown that $\mathbb{Z}$ is not cancellable, but if we only allow $A$ and $B$ to be abelian, it is (see here).
I would like to know if there are any groups that can be cancelled from free products rather than direct products. That is:

Is there a non-trivial group $C$ such that $A*C \cong B*C$ implies $A \cong B$?

It is certainly not true that every group is cancellable in free products. For example, if $A$, $B$, $C$ are the free groups on one, two, and infinitely many generators respectively, then $A*C \cong C \cong B*C$ but $A\not\cong B$. Many non-examples can be constructed this way, but they are all infinitely generated.
As is discussed in the original MSE question, it follows from Grushko's decomposition theorem that if $A$, $B$, and $C$ are finitely generated, then $A*C \cong B*C$ implies $A \cong B$.

REPLY [18 votes]: Ian Agol's answer only uses two properties of $\mathbb{Z}/2\mathbb{Z}$: it is freely indecomposable, and it is not isomorphic to a proper subgroup of itself. There are many other groups which have these two properties, e.g. finite groups.
A group which is not isomorphic to a proper subgroup of itself is called co-Hopfian. As I recently learnt on MSE, all co-Hopfian groups are freely indecomposable: if $H$ and $K$ are non-trivial, their free product $H\ast K$ has the proper isomorphic subgroup $H\ast (kh)K(kh)^{-1}$ where $h \in H$ and $k \in K$ are non-identity elements. So we can conclude the following:

For any co-Hopfian group $C$, if $A\ast C \cong B\ast C$, then $A\cong B$.

Examples of co-Hopfian groups include finite groups, $\mathbb{Q}$, $\mathbb{Q}/\mathbb{Z}$, and fundamental groups of closed hyperbolic manifolds. This last class of examples leads to the following observation:

Let $M$, $M'$, and $N$ be closed hyperbolic manifolds. If $M\# N$ is diffeomorphic to $M'\# N$, then $M$ is diffeomorphic to $M'$.

Proof: In dimension two, the assumptions imply $M$ and $M'$ have the same genus and are therefore diffeomorphic. In dimensions greater than two we have
$$\pi_1(M)\ast\pi_1(N) \cong \pi_1(M\# N) \cong \pi_1(M'\# N) \cong \pi_1(M')\ast\pi_1(N).$$
As $\pi_1(N)$ is co-Hopfian, we see that $\pi_1(M) \cong \pi_1(M')$, so $M$ and $M'$ are diffeomorphic by Mostow rigidity. $\,\square$
Note, there are many examples of manifolds $M$, $M'$, and $N$ for which $M\# N$ is diffeomorphic to $M'\# N$, but $M$ is not diffeomorphic to $M'$, e.g. $M = T^2$, $M' = \mathbb{RP}^2\#\mathbb{RP}^2$, and $N = \mathbb{RP}^2$. For an orientable example, take $M = S^2\times S^2$, $M' = \mathbb{CP}^2\#\overline{\mathbb{CP}^2}$, and $N = \overline{\mathbb{CP}^2}$.