Caring dog waited by friend’s side all night after it was hit by a car