It depends how was the Apple ID account created .
( a ) with secondary authentication - in which three answers for security questions , date of birth , rescue mail address and its own password , credit card details are added - do you still know these credentials , complete Apple ID and its password .
( b ) Account set up with two factor authentication in which trusted numbers are added and verified .
In the common Mac used by both what is the status , have you signed out Apple ID from system preferences or what , please post a screen shot of it ( hide your mail address ) .
If your friend had added his iPhone / a different Mac in your own laptop that you now possess , those devices can be removed see the article Check your Apple ID device list to see where you're signed in - Apple Support
One thing you can do change the Apple ID from appleid.apple.com Change your Apple ID - Apple Support
once your Apple ID and its password is added ( click on edit , add the credentials click on done to save ) , remove his Apple ID that will appear below your primary Apple ID address ( you have to click on cross sign for his Apple ID address .