Q:

Direction of Friction Force of a box on a moving truck ( question is different and not as advanced, focused on a situation )

If there is a box on a truck. The truck is accelerating to the right. The question asks us to draw all forces applying on the box. (Free body diagram of the box)
I have done this, but I always read that friction is opposite to the direction of motion. But when I read in other places the static friction that is holding the box and the truck together is in the direction of the truck. Can you please check if I am right? Thank you.

It is not the same question, it is more simple in nature, those answers are not clear bearing this question in mind. Thank you.

A:

In this case, the truck is accelerating to the right, and hence the body feels a pseudo-force in the opposite direction, i.e, in the left direction, in a reference frame fixed to the truck. 
If you have convinced yourself up to this, then consider the body-truck interface. The body has a tendency to slide in the left direction, as the pseudo-force on it tends to drive it to the left.
Now the crucial point. Friction always acts in the direction so as to resist the relative sliding between the two surfaces in contact. As the body feels a force to the left, the static friction, which  holds the body in its place, must act to the right, to maintain equilibrium. 
Hence, you must take into account the relative sliding between the two bodies in contact. Though the truck along with the body is moving in the right direction, you should judge the situation from a reference frame fixed on the truck. Then you can efficiently judge the relative motion between the truck and the body. But you are judging from the ground reference frame, in which the body is also accelerating to the right along with the truck. That's what ran you in confusion.

