The Messenger of Allah ﷺ said, "The dream of a believer is one of forty parts of prophethood. It rests on the foot of a bird as long as it is not spoken of, but once it is told, it falls."The narrator said, I think he also said, "And it should only be told to someone wise or someone beloved."
حدثنا محمود بن غيلان حدثنا أبو داود قال أنبأنا شعبة قال أخبرني يعلى بن عطاء قال سمعت وكيع بن عدس
قال رسول الله ﷺ رؤيا المؤمن جزء من أربعين جزءا من النبوة وهي على رجل طائر ما لم يتحدث بها فإذا تحدث بها سقطت قال وأحسبه قال ولا يحدث بها إلا لبيبا أو حبيبا
Grading, its chain of transmission is hasan. Abu Dawud narrated it in the Book of Manners, chapter on dreams, no. 5020, and Ibn Majah, no. 3914, both from the hadith of Yaala bin Ata with the same wording. It is also found in Musnad Abu Dawud Tayalisi, no. 1088. Ibn Hibban graded it sahih, no. 179717950, as did Ibn Daqiq Eid and Hakim, 4/390, and Dhahabi agreed with him. Hafiz graded it hasan in Fath al-Bari, 2/432.