This trial is conducted in Europe. The aim of the trial is to investigate the pharmacokinetics (the exposure of the trial drug in the body), safety and tolerability of oral semaglutide (NNC0113-0217) in subjects with mild, moderate and severe degrees of hepatic impairment compared to subjects with normal hepatic function.