Taoist philosopher Chuang Tzu, in a section of his writings about dreams:
Those who dream of a banquet may wake to lamentation and sorrow. These who dream of lamentation and sorrow may wake to join a hunt. While they dream, they do not know that they dream. Some will even experience a dream within a dream; and only when they awake do they realize they dreamed of a dream. By and by comes the great awakening, and then we may find out that this life is really an extended dream. Fools think they are awake now, and flatter themselves they know if they are really princes or peasants. Confucius and you are both dreams; and i who say you are dreams - i am but a dream myself. This is a paradox. Tomorrow a wise man may come forward to explain it; but that tomorrow will not be until ten thousand generations have gone by.
Once upon a time, i,Chuang Tzu, dreamt i was a butterfly, fluttering hither and thither, to all intents and purposes a butterfly. i was conscious only of following my fancies as a butterfly, and was unconscious of my individuality as a man. Suddenly i awakened, and there i lay, myself again. Now i do not know whether i was then a man dreaming i was a butterfly, or whether i am now a butterfly dreaming i am a man. between a man and a butterfly there is necessarily a barrier. The transition is called metempsychosis [the transmigration of the soul]. (Emphases mine. Source: Humanistic Texts.)