How to add link to create relationship in a view
I found out this could be done without writing custom code. 

In the view:


I added a field, User:uid.
I unchecked "create a label" and "link this field to its user" 
Using Rewrite results, i checked Rewrite the output of this field and input "Add as friend". 
I checked the "Output this field as a link" and then added the path www.example.com/relationship/[uid]request/1?destination=user/[uid] 


That solved the issue.