When I was 15 years old, I went through a pretty rough time on top of already dealing with depression, and I had recently started dating a guy at school. I opened up to him about my depression because I thought he'd understand and support me through it, and I can clearly remember my disappointment when he told me that other people have it worse and I should be grateful for my life.
He didn't know it, but that was something I already reminded myself of frequently because it was something people told me growing up.
If I left food on my plate at dinner, which was often, then someone would inevitably say "You know, a starving kid on the streets would be more than happy to eat everything on their plate!". Perhaps this mantra of sorts subconsciously set me up to brush aside my own feelings because of the constant reminder that other people had it worse. It didn't magically make me happier to know that I have it good in comparison, it made me feel that much worse because I wished it was enough.
I'm not inherently against using gratitude as a coping mechanism since I have used a gratitude journal and mindfulness in the past.
However, I used them as tools in combination with medication and therapy, because for me and many other people gratitude will not cure my depression. I should know since I tried it for years before actually getting treatment. There are legitimate ways to use gratitude to cope, but I am against using it to disregard people's feelings. By responding that way when someone decides to open up to you, you trivialize their feelings and oversimplify it whether you're aware of it or not. Some depression is situational, and some depression is caused by a chemical imbalance; whatever the reason you should take someone seriously when they say they're depressed.
Some helpful ways to respond to someone when they tell you they're depressed would be to ask them how you can help, remind them that you're here for them, check in on how they're doing mentally, and let them know that they're not alone. If they're not currently seeing anyone about their mental health then encourage them to seek treatment. If finances are a barrier to treatment, you might try researching low-income treatment centers in your area.
No one expects you to take their pain away, but simply offering support can be so helpful to people with depression – it's much more helpful than ignoring their pain.
Just remember all feelings are valid, and someone else's pain doesn't erase your pain.