iPhone issues and Apple ID
You bumped into what’s known as Activation Lock.This iPhone is still locked to your friend’s Apple ID, and order to change ownership, your friend will need to provide his Apple ID password for you.

Since your friend is far away, they may be able to disable Activation Lock remotely, by logging in to iCloud.com.

Have them go into Find my iPhone and select the iPhone. Since you’ve already wiped it, it will show as offline and grayed out. Just click Remove from Account.