Sharp Constants and Optimizers for a Class of Caffarelli–Kohn–Nirenberg Inequalities