In a monarchy, can a regent legally become monarch over a rightful heir?

In my book, I want the King to name someone unrelated to himself as his Successor, even though he has a legal heir. Would this work in a monarchy, or what? Of course i can write politics into the story so that the legal heir attempts to overthrow the Regent whom the King selected.

In a monarchy, can a regent legally become monarch over a rightful heir?
Post Opinion