Last night I built a copy of gfortran from a snapshot of the latest 16.0 trunk (to test a different bug that they fixed). Compiles your code fine as well.
The lfortran compiler (a snapshot from a few days ago) does not:
$ lfortran -c bst_base.f90
semantic error: Derived type 'bst_base_node_type' not declared
--> bst_base.f90:16:7
|
16 | class(bst_base_node_type), allocatable :: left
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: Please report unclear, confusing or incorrect messages as bugs at
https://github.com/lfortran/lfortran/issues.