There are two boxes on top of each other. The bottom box is dragged right by a constant force. What is the direction of friction of the top box against the bottom box?
Think of it like this and you will never be confused:
Friction always tries to keep the two objects together.
This regards both static and kinetic friction ($f_s$ and $f_k$) .
If something is sliding to the right over asphalt (kinetic friction), friction will try to stop this relative motion, and hold the object and the asphalt together. So $f_k$ will act to the left on the object and to the right on the asphalt.
If one box is on top of another as your example (static friction) and the bottommost speeds up to the right, then the uppermost has to be dragged by friction in the same direction in order for them to stay together. $f_s$ pulls right on the uppermost object and to the left on the bottommost object.
Obviously the friction on the top box will be along the direction of force(because of which the top box moves) and friction on the bottom box will be opposite to the force.
A kinetic friction force that acts on a body always has an opposite direction to that in which the body is moving. So, if you have a system Surface+Body A+Body B, where B is on top of A and A is moving to the right, both the surface and B will exert a friction force on A, pointing to the left. Moreover, according to Newton's third law, A will exert a friction force on both the surface and B, with opposite direction (that is, to the right).