Jackie gave Beth a present because it was her friend's birthday.

Who is "her" in this prior sentence?
Jackie
The cap fell off the bottle because it was untwisted.

Who is "it" in this prior sentence?
The cap
The boy tried to address his friend, but he could not hear.

Who is "he" in this prior sentence?

his friend