Its a story by Robert Heinlein titled - All You Zombies.. The summary goes like this! -
A baby girl is mysteriously dropped off at an orphanage in Cleveland in 1945. "Jane" grows up lonely and dejected, not knowing who her parents are, until one day in 1963 she is strangely attracted to a drifter. She falls in love with him. But just when things are finally looking up for Jane, a series of disasters strike. First, she becomes pregnant by the drifter, who then disappears. Second, during the complicated delivery, doctors find that Jane has both sets of sex organs, and to save her life, they are forced to surgically convert "her" to a "him." Finally, a mysterious stranger kidnaps her baby from the delivery room.
Reeling from these disasters, rejected by society, scorned by fate, "he" becomes a drunkard and drifter. Not only has Jane lost her parents and her lover, but he has lost his only child as well. Years later, in 1970, he stumbles into a lonely bar, called Pop's Place, and spills out his pathetic story to an elderly bartender. The sympathetic bartender offers the drifter the chance to avenge the stranger who left her pregnant and abandoned, on the condition that he join the "time travelers corps." Both of them enter a time machine, and the bartender drops off the drifter in 1963. The drifter is strangely attracted to a young orphan woman, who subsequently becomes pregnant.
The bartender then goes forward 9 months, kidnaps the baby girl from the hospital, and drops off the baby in an orphanage back in 1945. Then the bartender drops off the thoroughly confused drifter in 1985, to enlist in the time travelers corps. The drifter eventually gets his life together, becomes a respected and elderly member of the time travelers corps, and then disguises himself as a bartender and has his most difficult mission: a date with destiny, meeting a certain drifter at Pop's Place in 1970.
The question is: Who is Jane's mother, father, grandfather, grand mother, son, daughter, granddaughter, and grandson? The girl, the drifter, and the bartender, of course, are all the same person. These paradoxes can made your head spin, especially if you try to untangle Jane's twisted parentage. If we draw Jane's family tree, we find that all the branches are curled inward back on themselves, as in a circle. We come to the astonishing conclusion that she is her own mother and father! She is an entire family tree unto herself.
Thanks : Quora
Link to read the entire story: http://emilkirkegaard.dk/en/wp-content/uploads/Robert-A.-Heinlein-All-You-Zombies.pd
For movie lovers - please do watch the below movie : http://www.imdb.com/title/tt0910554/ - Severely underrated time travel movie!