Your friend has to read -> this Apple article: What to do before you sell, give away, or trade in your iPhone, iPad, or iPod touch
What to do before you sell, give away, or trade in your iPhone, iPad, or iPod touch - Apple Support
Then remove the iPhone from his device list, see this Apple article:
Check your Apple ID device list to see where you're signed in
Check your Apple ID device list to see where you're signed in - Apple Support
After that you can sign in with your Apple ID.
transferring my number over but the SIM card won’t work.
See this Apple article: How to unlock your iPhone for use with a different carrier
How to unlock your iPhone for use with a different carrier - Apple Support