In the verse you quoted, the word "Awliya" is used. It is a plural and its singular is "wali". The correct translation of the word ""wali"" is not "friend" but it is someone who is very close and intimate. It is also used to mean "guardian, protector, patron, lord and master".
In the Qur'an this word is used for God, such as [Allah is the Protector (or Lord and Master) of those who believe. He takes them out from the depths of darkness to light…] (Al- Baqarah 2: 257)
There are many other references in the Qur'an that give this meaning. The same word is also sometimes used in the Qur'an for human beings, such as [And whosoever is killed unjustly, We have granted his next kin "wali" the authority (to seek judgement or punishment in this case)…] (Al-‘Isra' 17 :33)
The correct translation of the verse in Surat Al-Ma’idah is: [O you who believe! Do not take Jews and Christians as your patrons. They are patrons of their own people. He among you who will turn to them for patronage is one of them. Verily Allah guides not a people unjust.] (Al-Ma'dah 5: 51)
It is obvious that Jews patronize the Jews and Christians patronize the Christians, so why not Muslims patronize Muslims and support their own people. This verse is not telling us to be against Jews or Christians, but it is telling us that we should take care of our own people and we must support each other.
In his Tafsir, (Qur’an exegesis) Imam Ibn Kathir has mentioned that some scholars say that this verse (i.e. the one you referred to) was revealed after the Battle of Uhud when Muslims had a set back. At that time, a Muslim from Madinah said, "I am going to live with Jews so I shall be safe in case another attack comes on Madinah." And another person said, "I am going to live with Christians so I shall be safe in case another attack comes on Madinah." So Allah revealed this verse reminding the believers that they should not seek the protection from others, but should protect each other. (See Ibn Kathir, Al-Tafsir, vol. 2, p. 68)