As for the three parts some scholars -especially from the shafi'i school of fiqh- base it on the verse itself:
... then eat from them and feed the needy and the beggar (22:36)
interpreting it as eat from it (1/3), feed the needy (1/3) and the beggar (1/3). Beside an interpretation of the hadith in Sahih Muslim and a former statement which was revised by this (See in Sahih Muslim and Sahih al-Bukhari). But there's generally no such rule or consensus:
Maalik said: “There is no limit to what may be eaten or given in charity or used to feed the poor or the rich, whether one wants to give it uncooked or cooked.” (al-Kaafi, 1/424).
The Shaafa’is said that it is mustahabb to give most of it in charity, and said: “At least one third of it may be eaten, and one third given in charity, and one third given away as gifts.” They said that one half may be eaten, but it is more correct to give some of it away in charity.” (Nayl al-Awtaar, 5/145; al-Siraaj al-Wahhaaj, 563).
Ahmad said: “We go along with the hadeeth of ‘Abd-Allaah (ibn ‘Abbaas – may Allaah be pleased with them both): ‘He should eat one third himself, feed one third to whomever he wants, and give one third in charity.” (Reported by Abu Moosa al-Isfahaani in al-Wazaa’if; he said it is a hasan hadeeth. This is also the opinion of Ibn Mas’ood and Ibn ‘Umar. No conflicting opinion is known among the Sahaabah. Al-Mughni, 8/632). (islamqa #3967)
One could stop at this point and say the ahadith and statements quoted above seem to indicate that among whomever he wants we may count friends. But there's another point.
But let's take a look at the meanings of the words القانع(translated above as the needy) and المعتر (translated above as the beggar).
(eat thereof, and feed Qani' and the Mu'tarr...)
This is a command which implies that this is permissible. Al-'Awfi reported that Ibn 'Abbas said, "Qani' القانع is the one who is content with what he is given and he stays in his house, and the Mu'tarr المعتر is the one who comes to you and rubs shoulders with you so that you will give him some meat, but he does not ask for it. " This was also the view of Mujahid and Muhammad bin Ka'b Al-Qurazi.
'Ali bin Abi Talhah reported that Ibn 'Abbas said, "Qani' is the one who is too proud to ask, and Mu'tarr is the one who does ask." This was also the view of Qatadah, Ibrahim An-Nakha'i and Mujahid, according to one report narrated from him. And the opposite was also suggested.
This Ayah has been quoted as evidence by those scholars who said that the sacrifice should be divided into three: a third for the one who offers the sacrifice to eat from, a third to be given as gifts to his friends, and a third to be given in charity to the poor, because Allah says:
(eat thereof, and feed the poor who does not ask, and the beggar who asks.) But there is no evidence in this Ayah for this view. (Source qtafsir)
Imam al-Qurtobi in his tafsir -see here in Arabic- when explaining the difference between both quoted a statement of imam Malik:
In the following I'll be quoting Arabic text and my own translations on it, take it with the necessary care.
وقال مالك : أحسن ما سمعت أن القانع الفقير ، والمعتر الزائر
Malik said: The best that I heard of is that al-Qani' refers to the poor who is sufficient while al-Mu'tarr refers to a visitor.
Imam ibn al-Jawzi in his tafsir called Zaad al-Massyr زاد المسير -see here in Arabic- distinguished between 6 meanings or opinions:
أحدها : أن القانع : الذي يسأل ، والمعتر : الذي يتعرض ولا يسأل : رواه بكر بن عبد الله عن ابن عباس ، وبه قال سعيد بن جبير ، واختاره الفراء .
Al-Qani' is that who asks or begs and al-Mu'atarr is that who may cross your way but don't ask. This was narrated by Bakr ibn 'Abdullah from ibn 'Abbas, and it was stated by Sa'id ibn Jubayr and the choice of al-Faraa'.
والثاني : أن القانع : المتعفف ، والمعتر : السائل : رواه علي بن أبي طلحة عن ابن عباس ، وبه قال قتادة ، والنخعي ، وعن الحسن كالقولين .
-This is basically the opposite- al-Qani' is the sufficient and al-Mu'tarr the beggar. 'Ali ibn abi Talha narrated this from ibn 'Abbas, and Qatadah, (Ibrahim) an-Nakha'i and al-Hassan (al-Basri) held this opinion.
والثالث : أن القانع : المستغني بما أعطيته وهو في بيته ، والمعتر : الذي يتعرض لك ويلم بك ولا يسأل : رواه العوفي عن ابن عباس .
Al-Qani' is that who is sufficient with whaterver you gave him and he is at home, while al-Mu'atarr is that that crosses your way and turns around you but don't beg for it. This was narretd by al-'Awfy from ibn 'Abbas. Mujahd explained al-Qani' similarly as your neighbour who is sufficient with what you gave him and al-Mu'tarr is that who cross your way but don't ask this view was favoured by al-Qurtobi.
والرابع : القانع : أهل مكة ، والمعتر : الذي يعتر بهم من غير أهل مكة : رواه خصيف عن مجاهد .
Al-Qani' are the people of Mekkah and al-Mu'tarr those you may find there except the people from Mekkah (a reference to hajj as it seems). This was narrated by Khassif from Mujahid
والخامس : القانع : الجار وإن كان غنيا ، والمعتر الذي يعتر بك : رواه ليث عن مجاهد .
Al-Qani'is the neighbour even if he was rich and Mu'tarr is that who is crossing your way. This was narrated by Laith ibn abi Salim from Mujahid.
والسادس : القانع : المسكين السائل ، والمعتر : الصديق الزائر : قاله زيد بن أسلم
Al-Qani' is the poor beggar and al-MU'tarr is the friend who is visiting you this was said by Zayd ibn Aslam.
From the above meanings one may conclude that friend or neighbour or relatives etc. are interpretations.