In the collapsing timeline created by River's attempt to rewrite a fixed point (in "The Wedding of River Song"), Amy remembered the original timeline, including her marriage to Rory & River being their daughter, because Amy's memory had been affected by the crack in her bedroom wall as she was growing up. The Doctor explained (to Auton Rory in "The Big Bang") that "Memories are more powerful than you think, and Amy Pond is not an ordinary girl. Grew up with a time crack in her wall. The universe pouring through her dreams every night."
After the universe was rebooted (also in "The Big Bang"), it was established (in "Good Night") that Amy could remember both versions of her childhood -- the timeline from before the reboot, in which she grew up without her parents, & the timeline from after the reboot, in which she grew up with them.
Rory didn't remember things from other timelines until Amy helped him to do so. At the wedding reception in "The Big Bang", for example, he only remembered being plastic (an Auton) after Amy had started to remember the Doctor back into existence.