"Friction is a force which opposes the relative motion between two objects”.
Friction acts to oppose relative motion between surfaces of two objects.
For the simple example of a book resting on a flat table, the frictional force is zero. There is no force trying to move the book across the table, so there is no need for a frictional force because there is nothing for the frictional force to oppose. However, if we try to slide the book across the table, friction comes in to play.