Ideally you don't want you bed under a window. If it can't be avoided a headboard or keeping the window covered when sleeping is the cure. The window covering should be heavy drapes or blinds. I think thats what Marie says. Keep in mind different systems are going to vary slightly.
As for when you were growing up, there's alot more than just the bed under the window. There are so many factors that it would be hard to single out one thing and say it was the cause.