Which can be done by anyone considered to have the authority. Robert could have legitimized any one of his bastards in death, and Stannis does offer to legitimize Jon Snow as Jon Stark (and thus automatically confer on him a claim on the title Lord of Winterfell). Probably useful to distinguish here between recognized bastards and legitimate bastards - Edric Strom is Robert's only recognized bastard, and he recognized him because his mother was highborn. He hasn't formally recognized his other bastards, and if he legitimized Edric he'd be Edric Baratheon and have a direct claim on the throne. So anyway hypothetically all you need to use a bastard to put a claim on the throne is to have someone with sufficient authority legitimize them. Of course. In fact one bastard son of the Duke of Normandy did rather well for himself, inheriting first his father's duchy and subsequently going on to successfully seize the English throne.