Your problem is your data model.
You're treating "friend" as an ENTITY unto itself, rather than a RELATIONSHIP between members.
Think of it like so:
User 1 can consider any number of other users to be a friend. Those users may not necessarily reciprocate.
The friendship table need contain only two columns: id and friendid. Neither should be unique.
MEMBERS
1 Fred
2 Barney
3 Wilma
4 Betty
5 Mr. Rubble
Fred and Barney consider each other to be friends. Each is friend with his/her own spouse. Wilma and Betty are friends. Mr. Rubble thinks Fred and Barney are friends, but they think think he's a jerk. The data now looks like this:
FRIENDSHIP
1 2
2 1
1 3
3 1
2 4
4 2
5 1
5 2
The necessary SQL is left to you.