Because reptiles and birds belong to the same clade. See this ongoing topic: Are birds really reptiles?
In short, birds evolved from theropod dinosaurs during the Jurassic (~165 million years ago). Reptile and amphibian lines diverged in the Carboniferous (~325 million years ago). Mammal and reptile lines also diverged in the Carboniferous.
Edit: Sorry, I get thrown off when the question to be answered is only in the title but not in the text body. I thought you were asking why reptiles are more closely related to birds than amphibians.