Language:
كتاب الفرائض
85  
Laws of Inheritance (Al-Faraa'id)
(9)
Chapter: The shares of inheritance for the paternal grandfather, the father and brothers
(9)
باب مِيرَاثِ الْجَدِّ مَعَ الأَبِ وَالإِخْوَةِ
Sahih al-Bukhari 6738

Narrated Ibn `Abbas:

The person about whom Allah's Messenger (ﷺ) said, "If I were to take a Khalil from this nation (my followers), then I would have taken him (i.e., Abu Bakr), but the Islamic Brotherhood is better (or said: good)," regarded a grandfather as the father himself (in inheritance).

حَدَّثَنَا أَبُو مَعْمَرٍ، حَدَّثَنَا عَبْدُ الْوَارِثِ، حَدَّثَنَا أَيُّوبُ، عَنْ عِكْرِمَةَ، عَنِ ابْنِ عَبَّاسٍ، قَالَ أَمَّا الَّذِي قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ لَوْ كُنْتُ مُتَّخِذًا مِنْ هَذِهِ الأُمَّةِ خَلِيلاً لاَتَّخَذْتُهُ، وَلَكِنْ خُلَّةُ الإِسْلاَمِ أَفْضَلُ ‏"‏‏.‏ أَوْ قَالَ ‏"‏ خَيْرٌ ‏"‏‏.‏ فَإِنَّهُ أَنْزَلَهُ أَبًا‏.‏ أَوْ قَالَ قَضَاهُ أَبًا‏.‏
Reference : Sahih al-Bukhari 6738
In-book reference : Book 85, Hadith 15
USC-MSA web (English) reference : Vol. 8, Book 80, Hadith 730
  (deprecated numbering scheme)