As far as I know in JVM languages, of which Scala is one, the entry point to a program is called a main function, and has to follow a specific definition: it must be called main, be a static function, public, void-returning, and accept only the language's equivalent of a String[] as arguments.
In Scala 3, there is some syntax sugar offered to make the program entry point easier to define, less verbose, and more flexible. Essentially, just about any method defined at the top-level or inside of an object can be annotated with @main and become an entry point. However, what is tripping you up in this case is the argument of type B you have defined for your @main-annotated method foo(). The JVM passes arguments to your program in the form of a String array (hence why the main method must accept a String[]).
In Scala 3, if you define arguments to a @main method, the compiler will attempt to translate the string arguments passed to your program into the argument types of your main method. It does this by using given instances (previously implicits) of scala.util.CommandLineParser.FromString for the types your method expects. By default, the compiler provides instances for certain types (for example, the primitives). However, because you don't define a given instance of CommandLineParser.FromString for a B, you get the error message
no implicit argument of type scala.util.CommandLineParser.FromString[basics.B] was found ...
Instead, you can make a different @main function to run your program that accepts either no args or the standard Array[String], accept in Int into your @main function and construct the B you want with that, or provide a given CommandLineParser.FromString[B], perhaps by using any of the libraries suggested in the comments.
More details: https://docs.scala-lang.org/scala3/book/methods-main-methods.html
maindef mainon JVM accepts ONLYArray[String]and this is what will be generated by@mainannotation. If you want to use some custom format then use something like Scopt or Droste or Mainargs to parse your input into the class inside main. The only exception that I know of are Ammonite scripts with their own@mainannotation. But that's non-standard.