Let $A$, $B$ and $C$ be discrete countable groups. Let $\alpha$ be an action of $A$ on $B$ and let $\beta$ be an action of $B$ on $C$.



> 
> **Question** Does there always exist a group $G$ which has $A$, $B$ and $C$ as subgroups and such that the group generated by $A$ and $B$ is $A\ltimes B$ and the group generated by $B$ and $C$ is $B\ltimes C$?
> 
> 
> 


One obvious situation when such a group $G$ exists is when the action $\beta$ extends to an action of $A\ltimes B$. Then we can take $G=(A\ltimes B)\ltimes C$. But I'm interested in situations when $\beta$ doesn't extend.


For example take $A$ to be the infinite cyclic group with generator $t$, $B$ to be the free group on infinitely many generators indexed by $\mathbb Z$ (denote the generators by $g\_n, n\in \mathbb Z$), and $C$ to be the rational numbers. Let $g\_n$ act on $C$ by multiplication by $n$ if $n\neq 0$ and by identity for $n=0$, and let $t$ act on $B$ by sending $g\_n$ to $g\_{n+1}$. 



> 
> **Question** In this specific situation does there exist $G$ as above?
> 
> 
> 



"double" semidirect product
The answer to the specific question is "yes". Let $U$ be the semidirect product of $C$ and $B$. Then as $G$, you take the HNN extension of $U$ with the free letter $t$ and associated subgroups equal to $B$, with the automorphism provided by the shift of generators. The result then follows from the usual properties of HNN extensions. The same argument applies in general when $A$ is cyclic. 


In general you can take the semidirect products and take their amalgamated product with amalgamated subgroup $B$. 


