Adding as a friend and viewing another user

Please tell me how you can organize the ability to add friends and view another user’s page. The registration itself has already been done. Maybe there is an article somewhere … tell me, I will be very grateful!

Answer 1, authority 100%

I don’t understand why reinvent the wheel, pay attention to ready-made open systems, for example elgg, opensocialetc.