Sounds like the magnetic field produced from the coil where the compass is placed, is equal to Earth's magnetic field, just perpendicular. This would explain why it would move 45 degrees from its initial position.
I am Zak, and am currently taking university level physics 2 with calculus. Physics is awesome, simply put. The fact that we can quantify, calculate, and relate all the interactions of energy is one of the highest levels of achievement of society. So, let's do some physics!