Is this where you could use polymorphic associations?

Could somebody help me wrap my head around this one?

Tables: users
id
username
password

Tables: friends
id
user_id
share_id

Tables: books
id
user_id
title
author

Users get to store as many books as they want.
Users has_many :books, and books belong_to :user
Users have the option of adding other users so that they can view their
books to.

For this process, a new record is created in Friends with the user_id of
the current user and share_id of the user they want to view.

How do you perform a find on the books of a user’s friends? I could use
a through association on searching the books that belong just to the
user. A loop would be terribly inefficient. After reading about
polymorphic associations, it seemed like an option but I just can’t
figure it out.

Thanks in advance to anyone who can lend a hand.