Quantum phase transition in a resonant level coupled to interacting leads