You can try restoring to your last backup, but there is no gaurantee that this will restore your contacts.
Your friend needs to set up a different iCloud account with a different ID. Have them go to Settings>iCloud, tap Delete Account, choose Keep on My iDevice when prompted, then set up a new iCloud account with a different ID, and choose Merge to upload the data to the new account. After doing this, you can each go to your own iCloud account on icloud.com and delete the other person's data from your account. Don't delete any data until you are on separate accounts or it will also be deleted from the other person's device.