“The Qur'an does not say that non-Muslims cannot be Muslims' friends, nor does it forbid Muslims to be friendly to non-Muslims. There are many non-Muslims who are good friends of Muslim individuals and the Muslim community. There are also many good Muslims who truly and sincerely observe their faith and are very friendly to many non-Muslims at the same time.
Islam teaches us that we should be friendly to all people. Islam teaches us that we should deal even with our enemies with justice and fairness. Allah says in the Qur'an in the beginning of the same Surat Al-Ma’dah: “O you who believe! Stand out firmly for Allah as witnesses to fair dealings and let not the hatred of others to you make you swerve to wrong and depart from justice. Be just, that is next to piety. Fear Allah, indeed Allah is well-acquainted with all that you do.” (Al-Ma’dah :8)
In another place in the Qur'an, Allah Almighty says:
“Allah forbids you not with regard to those who fight you not for your faith, nor drive you out of your homes, from dealing kindly and justly with them. For Allah loves those who are just. Allah only forbids you with regard to those who fight you for your faith, and drive you out of your homes and support others in driving you out, from turning to them for protection (or taking them as wali). Those who seek their protection they are indeed wrong- doers.” (Al-Mumtahinah: 8-9)
Moreover, Allah Almighty has described Prophet Muhammad, peace and blessings be upon him, as "a mercy" to the worlds. He was a sign of Allah's Mercy to all, Muslims as well as non-Muslims. In his kindness and fair treatment he did not make any difference between the believers and non-believers. He was kind to the pagans of Makkah and fought them only when they fought him. He made treaties with the Jews of Madinah and honored the treaties until they broke them.
He, peace and blessings be upon him, is reported to have received the Christians of Najran with kindness in his Masjid in Madinah. They argued with him about Islam, but he returned them with honor and respect. There are many examples from his life that show that he was the friendliest person to all people.
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: 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' :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 :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)
Muslims are allowed to have non-Muslims as friends as long as they keep their own faith and commitment to Islam pure and strong. You are correct in pointing out that a Muslim man is also allowed to marry a Jewish or Christian woman. It is obvious that one marries someone for love and friendship. If friendship between Muslims and Jews or Christians was forbidden, then why would Islam allow a Muslim man to marry a Jew or Christian woman? It is the duty of Muslims to patronize Muslims. They should not patronize any one who is against their faith or who fights their faith, even if they were their fathers and brothers. Allah says: “O you who believe! Take not for protectors (awliya') your fathers and your brothers if they love unbelief above faith. If any of you do so, they are indeed wrong-doers.” (Al-Tawbah : 23)
In a similar way, the Qur'an also tells Muslims that they should never patronize the non-Muslims against other Muslims. However, if some Muslims do wrong to some non-Muslims, it is Muslims duty to help the non-Muslims and save them from oppression . The Prophet, peace and blessings be upon him, said that he himself will defend a Dhimmi living among Muslims to whom injustice is done by Muslims. But Islam also teaches that Muslims should not seek the patronage of non-Muslims against other Muslims. They should try to solve their problems among themselves. Allah Almighty says, “Let not the Believers take the unbelievers as their patrons over against the Believers…” (Aal-'Imran :28)
He Almighty also says: “O you who believe! Take not for patrons unbelievers rather than Believers. Do you wish to offer Allah an open proof against yourselves?” (An-Nisaa’:144)
May Allah guide you to the straight path, and guide you to that which pleases Him, Amen.
Allah Almighty knows best.