It works now

-The loops were in the wrong order
-deck d instead of deck d() in main
-front has to be initialized to NULL in constructor