Abu Hurairah (May Allah be pleased with him) reported:
Messenger of Allah (ﷺ) said, "When one of you meets a brother (in Faith) he should greet him. Then if a tree or a wall or a stone intervenes between them and then he meets him again, he should greet him."[Abu Dawud].
App reference: Book 6, Hadith 16
Arabic/English book reference: Book 6, Hadith 860