It was narrated from ‘Aishah that the Messenger of Allah (ﷺ) gave permission for visiting the graves.
Sunan Ibn Majah Book 6, Hadith 138