Your question is a good one, mainly because I haven't been able to find a satisfactory answer. I have an answer, but I am unsure if it is the answer. It has certainly happened that a parent has been alive when their child was elected pope. Benedict IX (Catholic Encyclopedia entry) had the papacy handed to him by his father, and was largely a disgrace. However, his papacy was more than a thousand years ago (1012-1056), so I thought I would find a much more recent example.
I came up blank.
I consulted the books I have on the papacy, and found nothing.
I consulted someone with a degree in theology from a Catholic university. Blank again.
I applied what little skill I have at searching the web, and found no real answers.
It is possible that Benedict IX was the most recent example. While most popes have come from upper class families (who could afford good educations that would lead to rising in the Church's hierarchy) and could have a decent expectation of having a long lifespan due to access to good food and medical care, this is offset somewhat by the peculiarities of being elected pope. In general, most popes are of rather advanced ages themselves before they are elected. For instance, in the past couple centuries it is rare to even get a pope elected who is in his fifties, much less his forties. Since most popes have been cardinals before their election and it takes a good deal of time to be elevated to that station, there is only a small window of time where a parent would be alive when their child would be likely to be considered. There are also many times when a conclave desires a short pontificate and will therefore rule out candidates under a certain age. Put all of that together and you have the odds stacked against a parent seeing their child be elected to the papacy.
Hopefully, someone else will come along and give you an example that isn't a millennium old.
Boniface IX may be a more recent answer than the top comment. He was about 39 when elected pope in 1389 and was "charged with nepotism and he certainly provided generously for his mother, brothers, and nephews." It's too late for primary sources now, but from the linked secondary source we can certainly infer this occurred during his reign as pope.