In this poem, Shakespeare is comparing his friend to a summer's day. He knows that the summer is unpredictable and often loses it's luster behind the clouds of the day. It also has winds that are abusive and is temperate in that the good of summer comes and goes meaning sometimes it can be too hot or not hot enough.
In the end, the poet realizes that relationships are ever changing and drifting from one reality to another. Hence, though his friend, may compare to a summer's day, his love and friendship shall endure through the changes that come with life. No matter how we look at those we purport to love and no matter their flaws, it is those flaws that make up life and often give us our identities.
Sonnet 18 marks a shift in the Fair Friend group as the modus of immortalization shifts from the one through biological procreation to another idea--poetic immortality-- to textualize the beauty of the beloved so that it lives on even after the end of the person's life.
In the first quatrain, Shakespeare says he cannot compare the beauty of his friend to that of a 'Summer's day' as it is located very much within the flux of time--the inconsistency of sunlight and the sweet buds being abused by the harsh winds adds to the blemish of the day. It is more intemperate and less lovely than the loved one. Any analogy between the immortal (potentially) beauty of the beloved and the ephemeral beauty of nature is to turn the loved one into a mere mortal as all beautiful things decay in natural course over a certain period of time. For the comparison to stand tall, it has to be an 'eternal summer'.
Thus the poet decides to engraft the friend's beauty on to the eternal lines to time--the lines of his poetry so that death cannot drag him to his shadowy land of oblivion. The sonnet ends on a confident note with the couplet as it declares that these poetical lines would go on to establish the immortality of the friend, surviving as long as the humankind survives upon earth.