Molecules or ions that can behave both as Bronsted Acid and Bronsted Base are called amphiprotic substances. With HCl, water acts as a base in accepting a proton from the acid.
HCl+H2O→H3O++Cl−
Acid Base
Water is all acid while donating a proton to ammonia
NH3+H2O→NH+4+OH−
Base Acid