first of all see where the body is goin to move and how it is going to movefor eg:if moving forward the friction acts backwardson the body and vice versa
in case two bodies are stacked above each oter say the one on the bottom ia body-a and above it is is body -b and u pull body a with a string then friction acts back wards for body -a
in case of body b ,it would like to remain at rest because of force of inertia but it moves on because friction pulls it in the opposite direction (the direction where the force is applied)
i cited this example because i used to get confused with 2 body problems