You get the problem because you've trained your mind so that it gives you a wake up whistle only when it comes to attending classes/tests, which means, according to your body, any other thing is not obligatory during that time period. So your brain figures "I don't have to do this, so let me just sleep for some more time!" and it makes you oversleep or turn off your alarm or pull the blanket over your head and whatnot- which would be your cause and that there leads your problem, viz. your body is prepared to lose it's comfort only for important things, and you can't blame yourself for trying to make yourself comfortable! (It even goes to show that you're quite healthy and can differentiate what you really need and don't! that's something good!).
If I may offer a solution, you need to train yourself just to wake up early. Not for classes, not for sports but just to wake up early and begin the new day!. Just ask yourself to wake up like a mother would to her kid, gently. If you do that, not only do you get to attend all classes but it also gives you extra time on those free days when you can be even more productive with your life!. It maybe hard at the start but it reaps rewards as you go on!. Though you can train yourself only to wake up for lectures and tourist classes, I'd recommend you to do the before mentioned. But hey! it's your life! so just do what works for you!.
Hope that helped, good luck!