Supernova remnants and planetary nebulae