Your friend should carry out the steps in the following Apple Support article before giving the phone to you.
How to remove Activation Lock - Apple Support
What to do before you sell, give away, or trade in your iPhone or iPad - Apple Support
But if what you tell us is accurate, that's going to be a problem.
You say that the phone is locked to your friend's Apple Account but that he does not know the ID or password for his own account.
The only options for removing the Activation Lock are
- To use the appropriate credentials, or
- To submit an Activation Lock support request. Apple will only consider such a request if your friend has proof of original purchase that is acceptable to them, is not being managed by an organization's MDM system, and is not in Lost Mode. But your description of the phone as "locked to owner" suggests that the phone is displaying the "Locked to Owner" screen, is in Lost Mode, and therefore cannot be unlocked by filing a support request.