It's probably because you don't have int x defined in the file before you are trying initialize it with the constructor. Just switch them and it should work fine.
Your compiler may not recognise 'x' to be a local of 'B' as it isn't declared there but it is for sure a 'B' member. The value pointed by this has the member 'x' so it solves that problem.
But why does it work when I replace A<T> by A<char> or something else? Is there no way to avoid having always to use a this-pointer? The given code is only an example demonstrating the problem. All these this-pointers in my real program would make my code quite unreadable.
"x" is not a member of B...it is technically a member of A so when you use a method of B to access x the compiler may not be able to find it. However when you use "this" it is a pointer to the current class which will lead to it being able to find "x" as a member inherited from A. Hope that makes sense.