TITLE: Does there exist a group that is both a free product and a direct product of nontrivial groups?
QUESTION [5 upvotes]: Do there exist such nontrivial groups $A$, $B$, $C$ and $D$, such that $A \times B \cong C \ast D$?
I failed to construct any examples, so I decided to try to prove they do not exist by contradiction.
If such groups exist, then $C$ and $D$ are disjoint subgroups of $A \times B$. Suppose $w \in F[x, y]\ \{e\}$, where $F[x, y]$ is the free group with generators $x$ and $y$. Suppose $(a_c, b_c) \in C$, $(a_d, b_d) \in D$ and $h: F[x, y] \rightarrow A \times B$ is a homomorphism, that maps $x$ to  $(a_c, b_c)$ and $y$ to  $(a_d, b_d)$. Then, by definition of free product $h(w) \neq e$. Thus, either $\pi_A(h(w)) \neq e$ or $\pi_B(h(w)) \neq e$, where $\pi_A$ and $\pi_B$ are projections on $A \times B$ onto $A$ and $B$ respectively. Thus every group word is not an identity either for $A$ or for $B$ and that results in $\{A, B\}$ generating the variety of all groups. And here I am stuck, failing to determine anything else.
Or do the examples actually exist?

REPLY [4 votes]: To be a free product $C\ast D$ implies the existence of an action on oriented tree such that $C$ is the stabilizer of some vertex $v_0$ and such that edge stabilizers are trivial (so that nontrivial element fix at most one vertex). 
Let $(a,b)$ be a nontrivial element of $C$; we can suppose that $a\neq 1$ up to switch $A$ and $B$. Then in the Bass-Serre tree, $(a,b)$ fixes a unique vertex $v_0$, and hence this vertex is also fixed by the centralizer of $(a,b)$, and hence $(a,1)$ fixes $v_0$. Applying this to $(a,1)$ shows that $B$ fixes the vertex $v_0$. Choose $1\neq b'\in B$. It fixes the unique vertex $v_0$ and hence its centralizer fixes $v_0$, so $A$ fixes $v_0$. Finally $G=A\times B$ fixes $v_0$, so $D=1$.