Friedrich Nietzsche said this quote

Error regarding life necessary to life. - Every belief in the value and dignity of life rests on false thinking; it is possible only through the fact that empathy with the universal life and suffering of mankind is very feebly developed in the individual. Even those rarer men who think beyond themselves at all have an eye, not for this universal life, but for fenced-off portions of it. If one knows how to keep the exceptions principally in view, I mean the greatly gifted and pure of soul, takes their production for the goal of world-evolution and rejoices in the effects they in turn produce, one may believe in the value of life, because the one is overlooking all other men: thinking falsely, that is to say. And likewise if, though one does keep in view all mankind, one accords validity only to one species of drives, the less egoistical, and justifies them in face of all the others, then again one can hope for something of mankind as a whole and to this extent believe in the value of life: thus, in this case too, through falsity of thinking. Whichever of these attitudes one adopts, however, one is by adopting in an exception among men. The great majority endure life without complaining overmuch; they believe in the value of existence, but they do so precisely because each of them exists for himself alone, refusing to step out of himself as those exceptions do: everything outside themselves they notice not at all or at most as a dim shadow. Thus for the ordinary, everyday man the value of life rests solely on the fact that regards himself more highly than he does the world. The great lack of imagination from which he suffers means he is unable to feel his way into other beings and thus he participates as little as possible in their fortunes and sufferings. He, on the other hand, who really could participate in them would have to despair of the value of life; if he succeeded in encompassing and feeling within himself the total consciousness of mankind he would collapse with a curse on existence - for mankind has as a whole no goal, and the individual man when he regards its total course cannot derive from it any support or comfort, but must be reduced to despair. If in all he does he has before him the ultimate goallessness of man, his actions acquire in his own eyes the character of useless squandering. But to feel thus squandered, not merely as an individual fruits but as humanity as a whole, in the way we behold the individual fruits of nature squandered, is a feeling beyond all other feelings. - But who is capable of such a feeling? Certainly only a poet: and poets always know how to console themselves.