Annoying Problem with Includes

I've done a quick search of the forum but didn't see anything that matched my problem. I'm building a project that uses some of the Arduino built in libraries. I've been putting all of the includes and function prototypes into a single header to make my code a little cleaner, however when I try and build my project I get errors if the includes for the standard library are not also in my code file. For a simple example I've got three files: test.ino (my main code file with my setup & loop) header.h and code.cpp.
From this very simple example I can't understand why it wouldn't compile, my understanding is that if you include a header it adds all of the includes from that header, and this works as I would expect in visual studio.

Is this the correct/expected behaviour or is it an intricacy of the Arduino IDE/compiler

Tobyb121

test.ino:

#include "header.h"
#include <SD.h> //Without this line it cannot compile
void setup(void){}
void loop(void){}

header.h:

#pragma once
#ifndef HEADER_H
#define HEADER_H

#include <SD.h>

#endif

code.cpp:

#include "header.h"
//#include <SD.h> //Doesn't matter if I add this in, still won't compile unless it's in my main ino file
File file0;  //File is defined in SD.h

There appears to be some magic happening in the IDE. It looks like the sketch file is preparsed and if there are any #include<> directives, the environment will look for these and then add an appropriate -I to the compiler command line. A bit annoying, but I guess it removes the need to include all of directories, or have the user have to specify the ones needed.

This possibly could have been avoided, had they used a make file, but there may have been reasons not to.

Adrian