OIC!! the complex class is being initialised with no params when you use it like that - so you need to code a default constructor (one with no parameters). This should be standard practice but try adding:
/* INSIDE the complex class */
real = imag = 0;
This means when you use complex as a type/cast it will set real and imag to zero until you do anything with it - which wont matter in your case. Try the code.