Different directions of frictional force when objects are rolling My textbook has two instances of rolling bodies (smooth rolling). In the first, the body is rolling on the horizontal floor with some acceleration of its centre of mass. In this case, the book says that the friction will act in the direction the ball is accelerating. 
In the other instance, the ball is rolling down an incline. In this case, the book says that the force of friction acts opposite to $mg\sin\theta$, the component of the gravitational force parallel to the incline. 
I don't understand the difference. I mean, in both the cases, the ball experiences an acceleration due to a force. Why does the direction of friction change? For me the second case was more intuitive. The friction and gravity both induce torques of the same sign on the body. 
But I'm lost on the first case. The force that produces the acceleration and the frictional force clearly induce opposite torques which should cancel. Or atleast cancel partially. Also, my intuition says that for the first case, friction should act opposite to the direction of acceleration. 
I tried to get answers on the web, but I couldn't find anything that was explained in a lucid manner. Some websites mentioned that the direction of friction is affected if the force is applied at the axle. I don't see why that should be. 
 A: 
For me the second case was more intuitive. The friction and gravity both induce torques of the same sign on the body.

Gravity acts through the center of mass, which in this case aligns with the center of rotation.  So gravity is not inducing any torque.  All the torque is coming from friction.  If you imagine the same scenario where the ramp is frictionless, the ball will slide down instead of rolling.  No friction, no torque, no angular acceleration.
Friction is in the direction opposite the acceleration.  It is reducing the speed that the object would have.

But I'm lost on the first case.

For me the first case is ambiguous, because it says it is accelerating, but not how.  I think the obvious way to do it is by a force on the body (gravity, wind, string), which makes it just like the second case.  The object is forced in one direction, friction acts in the other direction (opposite the direction of the acceleration) and produces a torque.  Again, on a frictionless surface, the object would accelerate, but without friction giving a torque, it would not spin.
However, in the case of an automobile's drive wheel, the acceleration is due to a direct torque placed on the wheel by the engine.  There the friction opposes the wheel's angular acceleration and gives a force that points forward (toward the direction of the auto's acceleration).  Perhaps this is the case that they are considering.
A: Friction always opposes relative motion of the point of contact.
To know the direction of friction assume that no friction is present and see the direction in which point of contact is moving: friction is opposite to that direction .
A: In the case of sphere when it roles you have to analyse in which direction is the force acting. Consider a force acting along a line passing through its center of mass, now this force is not going to roll the sphere it's going to slide the sphere. For rolling a sphere an external torque must be given to it and as we know friction always opposes relative motion so if torque acts clockwise friction acts in a way to produce an anticlockwise torque.               Let us analyse sphere rolling on a ramp the only force acts on the sphere is mgSin(theta) that to on center of mass so this force doesn't give a torque and for sphere to speed up frictional force starts acting in backward direction. Frictional force is a self adjusting force. 
