Hazrat Moulana Ashraf Ali Thanwi (rahmatullahi ‘alaih) once mentioned:
The main cause of one falling into the sin of ingratitude and being ungrateful to Allah Ta‘ala for His favours is that one forgets about all the favours that Allah Ta‘ala is blessing him with and only thinks and grieves over what he does not have.
In other words, ingratitude is created in a person’s heart when he fails to look at the many favours of Allah Ta‘ala that he is enjoying, and instead only focuses on that which he does not possess. Conversely, if a person constantly keeps in mind the abundant favours and bounties of Allah Ta‘ala that he enjoys, and is not concerned about that which he does not have, then naturally the feeling of gratitude will be created within his heart.
In one Hadith, Rasulullah (sallallahu ‘alaihi wasallam) advised Hazrat Aaishah (radhiyallahu ‘anha) saying:
يا عائشة أحبي المساكين وقرّبيهم
O Aaishah! Love the poor, and associate with them. (Sunan Tirmizi #2352)
Some Ulama have explained that one benefit of this is that through remaining in the company of the poor, one will see how much more he possesses compared to them. This will cause him to value the bounties that he is enjoying and will assist him to express appreciation and gratitude to Allah Ta‘ala.
(Malfoozaat Hakeemul Ummat 24/322)