Completely restore iPhone 5?

So i bought an iPhone from my friend and I want to sign in with my iCloud
i already did a factory reset but the phone still is making me sign in with the iCloud account that started the phone
i have an iPhone 5c, is there any way I can reset it completely? Like if brand new

Restore the phone to wipe it. You can't complete the restore if it is linked to the owners id. If this was received from a friend there's no issue getting the password.