you can. there are auto-switches, these are used by diesel generators. The better question, is what happens when the power goes out at night.
When the power goes out at night I typically go to bed.
Do people commonly do this for regularly residential setups? I wonder if I've just been talking to the wrong people.