Depends what it is …………….
If it’s a straight forward steel faster that is rusty, them penetrating oil like Plus-Gas (not WD40) is the way to go.
If it is dissimilar metal, like stainless steel into Aluminium the issue is a little different as it has been caused by electrolysis, and the method described by Pikey Dave is perfect. Usually, with electrolysis locked components, heat is your best friend to make the Aluminium casting expand, then apply liberal amounts of boiling water.
If the casting is painted, then careful use of a heat gun is preferred, however, we normally wrap the casting compnent in a heat resistant blanket and use a small application of the gas axe