How does heat energy interact between two bodies of different heat capacities in order to attain thermal equilibrium? Suppose there are two objects $A$ &amp; $B$ of same mass; the former has specific heat capacity $C_A$ and the later has $C_B$ such that $C_A\gt C_B.$ Let $A$ be at temperature $T$ while $B$ be at $T+\Delta T.$ So, in order to attain thermal equilibrium, they have to attain the same temperature $T+ \frac{\Delta T}{2}.$ That means there would be a change of $\frac{\Delta T}{2}$ in both bodies. For that, $A$ must gain heat energy $Q_A= m\;C_A\cdot \frac{\Delta T}{2}$ while $B$ has to loss heat energy $Q_B=m\;C_B\cdot \frac{\Delta T}{2}.$ Now, $Q_A-Q_B\gt 0$ since $C_A\gt C_B.$

Then in order to attain the equilibrium temperature, $A$ has to get $Q_A$ energy which it receives partly from $B$ viz. $Q_B$ but where does the additional heat energy $Q_A-Q_B$ come from? It can't come from $B$ as that would deviate it from achieving the thermal temperature; $B$ can lose only $Q_B$ in order to attain $T+\frac{\Delta T}{2}.$ But where does $A$ get the extra energy $Q_A- Q_B$ from? 

I'm confused as I thought so-far that when two bodies achieve thermal equilibrium, they do it by exchanging heat energy between themselves - the cooler body receives heat energy fro the hotter body till the equilibrium is reached.

But here, it seems that $A$ in order to achieve thermal equilibrium, needs energy $Q_A$ which cannot be provided by $B$ since the energy $Q_B$ it releases  is less than $Q_A.$ Where would then the extra energy $Q_A-Q_B$ come from?

Let's say, somehow $A$ gained that energy from the surroundings; however what would happen if they were isolated from the surroundings?

I don't know where I'm mistaking. Is it true that the hotter body itself provide the required energy to the cooler body to attain thermal equilibrium? 

Please help.
Say the initial temperature of $A$ is $T_1$ and the initial temperature of $B$ is $T_2$. To determine the temperature ($T_f$) of $A$ and $B$ at equilibrium, we start with the equation $q_A=-q_B$, where $q_A$ and $q_B$ are the heat gained by $A$ and $B$ respectively as they reach equilibrium. We have $q_A=mc_A\Delta T_A=mc_A(T_f-T_1)$ and $q_B=mc_B\Delta T_B=mc_B(T_f-T_2)$. Thus the equation becomes $$mc_A(T_f-T_1)=-mc_B(T_f-T_2)$$ From here, we can solve for $T_f$. We can also note that if $c_A=c_B$, $T_f=\frac{T_1+T_2}{2}$ , which in your example is $T+\frac{\Delta T}{2}$. Otherwise, $T_f$ will not be the midpoint between $T_1$ and $T_2$.