كتاب الإيمان
1  
The Book of Faith
(93)
Chapter: Allegiance to the believers, and forsaking others and disavowing them
(93)
باب مُوَالاَةِ الْمُؤْمِنِينَ وَمُقَاطَعَةِ غَيْرِهِمْ وَالْبَرَاءَةِ مِنْهُمْ ‏‏
Sahih Muslim 215

'Amr b. 'As reported:

I heard it from the Messenger of Allah (ﷺ) quite audibly and not secretly: Behold! the posterity of my fathers, that is, so and so, are not my friends. Verily Allah and the pious believers are my friends.
حَدَّثَنِي أَحْمَدُ بْنُ حَنْبَلٍ، حَدَّثَنَا مُحَمَّدُ بْنُ جَعْفَرٍ، حَدَّثَنَا شُعْبَةُ، عَنْ إِسْمَاعِيلَ بْنِ أَبِي خَالِدٍ، عَنْ قَيْسٍ، عَنْ عَمْرِو بْنِ الْعَاصِ، قَالَ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم جِهَارًا غَيْرَ سِرٍّ يَقُولُ ‏ "‏ أَلاَ إِنَّ آلَ أَبِي - يَعْنِي فُلاَنًا - لَيْسُوا لِي بِأَوْلِيَاءَ إِنَّمَا وَلِيِّيَ اللَّهُ وَصَالِحُ الْمُؤْمِنِينَ ‏"‏ ‏.‏
Reference : Sahih Muslim 215
In-book reference : Book 1, Hadith 425
USC-MSA web (English) reference : Book 1, Hadith 417
  (deprecated numbering scheme)