Implicit Function Specialization: Does not apply Inheritance
## Summary
The implicit function specialization cannot match generic functions when an inherited class of the base class used in the definition is used
## System Information
Windows 10: FPC Trunk/main
## Example Project
```pascal
program Project1;
{$mode objfpc}{$H+}
{$ModeSwitch implicitfunctionspecialization}
type
generic TBase<T> = class(TObject);
generic TChild<T> = class(specialize TBase<T>);
generic procedure Foo<T>(lst: specialize TBase<T>);
begin
end;
var
lst: specialize TChild<Integer>;
begin
specialize Foo<Integer>(lst); // works
Foo(lst); // Error
end.```
[Project1.pas](/uploads/009fb874feba0e5b2c1a0dcd54611aa7/Project1.pas)
issue