Generalized S-Lemma and strong duality in nonconvex quadratic programming