"What a beautiful day" or "What the beautiful day"? And "why"?
Your friend is almost there, but the key here is that in "what a beautiful day", the day does not refer to the day at hand at all. The day at hand is omitted from the sentence. "What a beautiful day [it is]", "What a beautiful day [this day is]". This becomes clearer still if you look at the same construction in closely related languages such as German. This day here is a beautiful day. One of many. There can be any number of beautiful days.
As Jim points out in a comment, "one sometimes hears 'This is quite the beautiful day', where the meaning is 'this day fits the very definition of the quintessential beautiful day'". So again, even there the day does not refer to the day at hand. It refers to the one quintessential day.
Lastly, "What the [expletive]" is a very common swearing. Making "what the beautiful day" actually sound quite funny, as if you were mincing your words.
When used in this way as an exclamation, What is followed by a(n) with a singular countable noun, and by the noun alone when the noun is plural or uncountable. It’s probably best to consider it as an idiom, in which you have to take the expression as a whole without analysing its component parts.
Note: This is a response to nima_persian's answer to his or her own question.
You are right that the response would also use the indefinite article, but this is true in similar contexts not starting with the What a ... ! exclamation. For example, "Jack's a happy baby!" - "Yes, he's a very happy baby!" and so on.
The statement is that Jack is a baby who is happy. The response agrees that Jack is a baby who is happy. If you use the definite article Jack is the happy baby, then you are implying that of the babies to whom you are referring Jack is the one who is happy.
Similarly What a beautiful day! means that this is a day which is beautiful, and the response agrees that this is a day which is beautiful.
Note, however, that if you make day the subject of the sentence, you must use the definite article: Yes, the day is beautiful.