If your neck doesn't break you would have a chance but there is no "HOW" to the scenario - it would happen so fast it would be over before you had a chance to react or could even react as you would be thrown either outward or inward with considerable force, the latter being your best chance at survival.
How do you survive your car being crushed like this?
You probably wouldn't. The forces involved in caving in the roof of a modern car will very likely do lethal damage to your neck. Solution: drive safely.
My primary vehicle has a built-in roll cage that won't crush in a rollover accident. My other vehicle has a roll bar installed.
Unlikely that you would. The roof of a modern car is way stronger than on old cars.