I heard the Messenger of Allah ﷺ say, "Allah said, 'When I test My servant with the loss of his two beloved ones and he bears it patiently, I will compensate him with Paradise in their place.'" He meant his two eyes.
حدثنا يونس حدثنا ليث عن زيد يعني ابن الهاد عن عمرو
سمعت رسول الله ﷺ يقول إن الله عز وجل قال إذا ابتلي عبدي بحبيبتيه ثم صبر عوضته منهما الجنة يريد عينيه
Its isnad is sahih. Yazid bin Had is Yazid bin Abdullah bin Usama bin Had, and Amr is Ibn Abu Amr, the freed slave of Muttalib, who is trustworthy, his hadith being accepted by the group. Bukhari related the hadith in 10/116, number 5653, Fath al-Bari, in the book of illness, chapter on the merit of one who loses his sight. The hadith has already appeared with a different wording. In the printed edition it reads "Yazid bin Had," which is an error.