According to Zeroth law of thermodynamics, two systems in thermal equilibrium with a third system separately are in thermal equilibrium with each other.
So, if A and B are separately in equilibrium with C, then TA=TC and TB=TC.
This implies that TA=TB, i.e. the systems A and B are also in thermal equilibrium.