Suppose you have three bodies A, B and C. A and B are at same temperature. When B and C are brought in contact, heat flows from C to B until they are at same temperature. What will happen when A and C are brought in contact?
Heat will flow from C to A.
Suppose initially A and B are at a temperature T. When B and C are brought in contact, heat flows from C to B until they are at same temperature S. As heat flows from C to B, the equilibrium temperature S will be greater than T. So, when A and C are brought in contact, heat will flow from C to A.